package com.itheima.tanhua.utils;
import com.itheima.tanhua.domain.User;

/**
 * @author Lff
 * @date 2022/3/24
 */
public class UserHolder {
    private static ThreadLocal<User> threadLocal = new ThreadLocal<>();

    //获取threadLocal
    public static User getUser(){
        return threadLocal.get();
    }
    //移除threadLocal
    public static void remove(){
        threadLocal.remove();
    }
    //设置threadLocal
    public static void setUser(User user){
        threadLocal.set(user);
    }
}
